package com.api.shopapi.service.impl;


import com.api.shopapi.entity.AskAnswerGroup;
import com.api.shopapi.entity.AskAnswerRecord;
import com.api.shopapi.mapper.AskAnswerRecordMapper;
import com.api.shopapi.service.AskAnswerRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("AskAnswerRecordServiceImplOne")
public class AskAnswerRecordServiceImpl implements AskAnswerRecordService {

    @Autowired
    private AskAnswerRecordMapper askAnswerRecordMapper;

    @Override
    public
    int insert(AskAnswerRecord askAnswerRecord){
        return askAnswerRecordMapper.insert(askAnswerRecord);
    }


    @Override
    public
    int delete( String askAnswerRecordCode){
        return askAnswerRecordMapper.delete(askAnswerRecordCode);
    }

    @Override
    public
    int update(AskAnswerRecord askAnswerRecord){
        return askAnswerRecordMapper.update(askAnswerRecord);
    }


    @Override
    public
    AskAnswerRecord getByAskAnswerRecordCode(String askAnswerRecordCode){
        return askAnswerRecordMapper.getByAskAnswerRecordCode(askAnswerRecordCode);
    }

    @Override
    public
    AskAnswerRecord getByAskAnswerNameCode(String askAnswerNameCode){
        return askAnswerRecordMapper.getByAskAnswerNameCode(askAnswerNameCode);
    }


    @Override
    public
    List<AskAnswerRecord> ListByPracticeSiteCode(String practiceSiteCode){
        return askAnswerRecordMapper.ListByPracticeSiteCode(practiceSiteCode);
    }

    @Override
    public
    PageInfo<AskAnswerRecord> PageByGovernmentCodePracticeSiteCode(int pageIndex, int pageSize,
                                                                   String governmentCode, String practiceSiteCode){
        PageHelper.startPage(pageIndex,pageSize);
        List<AskAnswerRecord> complaintList =askAnswerRecordMapper.ListByGovernmentCodePracticeSiteCode(governmentCode,practiceSiteCode);
        return new PageInfo<>(complaintList);
    }


}
